package com.example.lx6_3.visit

import androidx.lifecycle.MutableLiveData
import com.example.base.entity.VisitEntity
import com.example.base.entity.VisitEntityItem
import com.example.base.mvvm.BaseViewModel
import com.example.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class VisitViewModel @Inject constructor(val apiService: ApiService) : BaseViewModel(){

    val visitData = MutableLiveData<VisitEntity>()

    fun getVisit(){
        httpRequest({apiService.getVisit()},visitData::postValue)
    }

    val addVisitData = MutableLiveData<VisitEntityItem>()

    fun getAddVisit(body:Any){
        httpRequest({apiService.getAddVis(toBody(body))},addVisitData::postValue)
    }

}